import { App, Directive } from 'vue'
import draggable from './draggable'
import resize from './resize'

type Directives = {
    [propName: string]: Directive
}

/** 指令列表 */
const directives: Directives = { draggable, resize }

/**
 * @ClassName directive
 * @Description 自定义的指令注册
 * @Author xuyizhuo
 * @Date 2024/5/24 12:27
 */
export default {
    /**
     * 全局注册组件，用Vue变量名在webstorm可以识别到组件已经注册，用其他名称无法识别。暂不清楚具体原因
     * @param {App} Vue
     */
    install: (Vue: App) => {
        //console.log('app', app)
        Object.keys(directives).forEach((key) => {
            //console.log('key', key)
            // 注册指令到app
            Vue.directive(key, directives[key])
        })
    },
}
